
<?php 	if( isset($articles) ) { ?>
<table border=0 cellspacing=0 cellpadding=4 width=100% class='cms-data-table'>
    <tr>
        <th align=right>
            <input type='checkbox' value='' id='checkAll' name='checkAll' />
        </th>
        <th align='left'>Article Title</th>
        <th>Options</th>
    </tr>
    <?php

   for($i = 0; $i < count($articles); $i++) {
      $title = $articles[$i]->getTitle();
      $id = $articles[$i]->getId();
	  $url = $articles[$i]->getURL();
	  
	  $pub_link_class = $articles[$i]->isPublished() ? 'cms-publish-link' : 'cms-unpublish-link';
	  $pub_link_title = $articles[$i]->isPublished() ? 'Published (Click To Unpublish)' : 'Unpublised (Click To Publish Now)';
	  
	  ?>
    <tr id='article-row-<?php echo $id; ?>'>
        <td align=right width='25'>
            <input type='checkbox' value='<?php echo $id; ?>' />
        </td>
        <td><?php echo ($i + 1) . "."; ?> <a id='<?php echo $id; ?>' class='edit-link' href='<?php echo $this->url(array('action' => 'edit_article', 'id' => $id)); ?>'><?php echo $title; ?></a></td>
        <td align=center width='34%'> 
            <a id='<?php echo $id; ?>' class='edit-link' href='<?php echo $this->url(array('action' => 'edit_article', 'id' => $id)); ?>'><img src='images/icons/newspaper.png' alt='' align='absmiddle' border=0 /> Edit</a> 
            <a id='<?php echo $id; ?>' class='delete-link' href='<?php echo $this->url(array('action' => 'delete_articles', 'ids' => $id)); ?>'><img src='images/icons/newspaper_delete.png' alt='Delete' align='absmiddle' border=0 /> Delete</a> 
            <a id='<?php echo $id; ?>' class='preview-link' href='<?php echo $url; ?>' target='_blank'><img src='images/icons/magnifier.png' alt='Preview' align='absmiddle' border=0 /></a> 
            <a id='<?php echo $id; ?>' class='<?php echo $pub_link_class; ?>' href='#' title='<?php echo $pub_link_title; ?>'></a>
        </td>
    </tr>
    <?php
     
   } ?>
</table>
<?php
	}
	// echo out the values of the total article count as hidden field in order to be accessed
	// by the javascript processor
	// we'll do this if only the first page is being loaded
   if( !isset($_POST['no-total']) && isset($total_articles) ) {
	   echo "
			<input type='hidden' id='articles-total' value='$total_articles' />
	   ";
   }
?>
